using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;

namespace DAO
{
    public class DataProvider
    {
       // public const string str = "Provider = Microsoft.Jet.OleDb.4.0; Data Source = QLPMT.mdb";
        public const string str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= QLPMT.mdb;Persist Security Info=False";
        public OleDbConnection cn;
        public DataProvider()
        {
            cn = new OleDbConnection(str);
        }

        public void Connect()
        {
            cn.Open();
        }

        public void Disconnect()
        {
            cn.Close();
        }

        public OleDbDataReader ReadData(string sql)
        {
            OleDbCommand cmd = new OleDbCommand(sql, cn);
            return cmd.ExecuteReader();
        }

        public void ExecuteQuery(string sql)
        {
            OleDbCommand cmd = new OleDbCommand(sql, cn);
            cmd.ExecuteNonQuery();
        }


        internal static OleDbConnection ConnectionData()
        {
            throw new Exception("The method or operation is not implement!!!");
        }
    }
}
